Skip to content

Add SQLite database preview support to Peek#45846

Open
thomastv wants to merge 2 commits intomicrosoft:mainfrom
thomastv:feature/sqlite-db-previewer
Open

Add SQLite database preview support to Peek#45846
thomastv wants to merge 2 commits intomicrosoft:mainfrom
thomastv:feature/sqlite-db-previewer

Conversation

@thomastv
Copy link

Summary of the Pull Request

This PR adds SQLite database file preview support to the Peek utility, resolving issue #45757 . Three new model classes (SQLiteTableInfo, SQLiteColumnInfo, ISQLitePreviewer) and a core SQLitePreviewer class were added to read .db, .sqlite, and .sqlite3 files read-only using Microsoft.Data.Sqlite, fetching table schema via PRAGMA table_info and up to 200 rows per table. A new SQLiteControl XAML control presents the data in a two-pane layout — a tree view listing all tables on the left and a data grid showing columns and rows on the right, with intelligent column sizing that stretches the last column when space allows and falls back to horizontal scrolling for wide tables. The previewer was wired into the existing previewerFactory and FilePreview host, and three localizable strings were added to Resources.resw.

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

  • Added the new SQLiteControl user control (SQLiteControl.xaml and SQLiteControl.xaml.cs) for visualizing SQLite database tables, columns, and data in a split-pane UI with a DataGrid and tree view.
  • Implemented supporting model classes: SQLiteTableInfo for table metadata and rows, and SQLiteColumnInfo for column details and display formatting.
  • Defined the ISQLitePreviewer interface for previewer implementations that expose SQLite table data and metadata.
  • Added the SQLitePreviewer to the previewer factory logic, enabling automatic detection and previewing of SQLite files.

Validation Steps Performed

  1. Verified that the new feature works locally
  2. Verified that the existing features are also working correctly after adding new changes
  3. Created a dummy .db file and verified that the default fallback screen appears, since it isn't a valid sqlite file
image

@github-actions

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add SQLite (.db) File Preview Support to Peek

1 participant